package org.dydl.dao.system.repository;

import org.dydl.model.system.SysRole;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface ISysRoleRepository extends CrudRepository<SysRole, Integer>, JpaSpecificationExecutor<SysRole> {

	@Query(value = " FROM SysRole sy ", countQuery = "SELECT count(sy.id) FROM SysRole sy")
	public Page<SysRole> getSysRoleList(Pageable pageable);

	@Query(value = " FROM SysRole sy WHERE sy.name LIKE :name", countQuery = "SELECT count(sy.id) FROM SysRole sy WHERE sy.name LIKE :name")
	public Page<SysRole> getSysRoleListLike(@Param("name") String name, Pageable pageable);
}
